-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor subgraph delete (#639)
- Loading branch information
1 parent
9b86870
commit cfadb04
Showing
6 changed files
with
84 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
...-client/src/query/subgraph/delete.graphql → ...y/subgraph/delete/delete_mutation.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
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 @@ | ||
mod mutation_runner; | ||
|
||
pub(crate) mod types; | ||
|
||
pub use mutation_runner::run; | ||
pub use types::{SubgraphDeleteInput, SubgraphDeleteResponse}; |
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,36 @@ | ||
use crate::query::subgraph::delete::mutation_runner::subgraph_delete_mutation; | ||
|
||
pub(crate) type MutationComposition = subgraph_delete_mutation::SubgraphDeleteMutationServiceRemoveImplementingServiceAndTriggerComposition; | ||
pub(crate) type MutationVariables = subgraph_delete_mutation::Variables; | ||
|
||
#[cfg(test)] | ||
pub(crate) type MutationCompositionErrors = subgraph_delete_mutation::SubgraphDeleteMutationServiceRemoveImplementingServiceAndTriggerCompositionErrors; | ||
|
||
#[derive(Debug, Clone, PartialEq)] | ||
pub struct SubgraphDeleteInput { | ||
pub graph_id: String, | ||
pub variant: String, | ||
pub subgraph: String, | ||
pub dry_run: bool, | ||
} | ||
|
||
/// this struct contains all the info needed to print the result of the delete. | ||
/// `updated_gateway` is true when composition succeeds and the gateway config | ||
/// is updated for the gateway to consume. `composition_errors` is just a list | ||
/// of strings for when there are composition errors as a result of the delete. | ||
#[derive(Debug, PartialEq)] | ||
pub struct SubgraphDeleteResponse { | ||
pub updated_gateway: bool, | ||
pub composition_errors: Option<Vec<String>>, | ||
} | ||
|
||
impl From<SubgraphDeleteInput> for MutationVariables { | ||
fn from(input: SubgraphDeleteInput) -> Self { | ||
Self { | ||
graph_id: input.graph_id, | ||
variant: input.variant, | ||
subgraph: input.subgraph, | ||
dry_run: input.dry_run, | ||
} | ||
} | ||
} |
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