Conditional Upsert - Mutations

Is there any way to abstract this condition at a schema level so as to prevent execution of mutations without the condition?